﻿@using WebApplication1.ViewModels
@using WebApplication1.Security.Validation;
@model CreateEmployeeViewModel
@{
    Layout = "~/Views/Shared/MyLayout.cshtml";
}
@section TitleSection{
    CreateEmployee
}
@section HeaderSection{
    <script src="~/Scripts/Validations.js"></script>

    <script>
        function ResetForm() {
            document.getElementById('TxtFName').value = "";
            document.getElementById('TxtLName').value = "";
            document.getElementById('TxtSalary').value = "";
        }
    </script>
}
@section ContentBody{
    <div>
        <form action="/Employee/SaveEmployee" method="post" id="EmployeeForm">
            <table>
                <tr>
                    <td>First Name:</td>
                    <td>
                        <input type="text" id="TxtFName" name="FirstName" value="@Model.FirstName" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">@Html.ValidationMessage("FirstName")</td>
                </tr>
                <tr>
                    <td>Last Name:</td>
                    <td><input type="text" id="TxtLName" name="LastName" value="@Model.LastName" /></td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        @Html.ValidationMessage("LastName")
                    </td>
                </tr>
                <tr>
                    <td>
                        Salary:
                    </td>
                    <td>
                        <input type="text" id="TxtSalary" name="Salary" value="@Model.Salary" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        @Html.ValidationMessage("Salary")
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" name="BtnSubmit" value="Save Employee" onclick="return IsValid();" />
                        <input type="submit" name="BtnSubmit" value="Cancel" />
                        <input type="button" name="BtnReset" value="Reset" onclick="ResetForm();" />
                    </td>
                </tr>
            </table>
            </form>
    </div>
}
@*<!DOCTYPE html>
    <html>
    <head>
        <meta name="viewport" content="width=device-width" />

        <title>CreateEmployee</title>
        <script src="~/Scripts/Validations.js"></script>
        <script>
            function ResetForm() {
                document.getElementById('TxtFName').value = "";
                document.getElementById('TxtLName').value = "";
                document.getElementById('TxtSalary').value = "";
            }
        </script>
    </head>*@

@*<body>
        <form action="/Employee/AddNew" id="AddNew" method="get" style="display:none">
            <!--那个隐藏的表表单-->
        </form>
            <div>
                <!--Form标签的method的方法,数据更新时候使用 Delete删除数据时候使用-->
                <form action="/Employee/SaveEmployee" method="post">
                    First Name	<input type="text" id="TxtFName" name="FirstName" value="" /><br />
                    Last Name	<input type="text" id="TxtLName" name="LastName" value="" /><br />
                    Salary	<input type="text" id="TxtSalary" name="Salary" value="" /><br />
                    <input type="submit" name="BtnSave" value="Save Employee" />
                    <!--当type = reset时，点击按钮重置会将input的值重置为其value值  没啥屌用-->
                    <input type="button" name="BtnReset" value="Reset" onclick="ResetForm();" />

                    <!--通过隐藏Form表单和JavaScript来实现页面跳转。-->
                    <input type="button" name="BtnSubmit" value="Cancel" onclick="document.getElementById('AddNew').submit()" />
                    </form>
            </div>
    </body>*@
@*<body>
        <form action="/Employee/SaveEmployee" method="post">
            <table>
                <tr>
                    <td>
                        First Name:
                    </td>
                    <td>
                        <input type="text" id="TxtFName" name="FirstName" value="@Model.FirstName" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        @Html.ValidationMessage("FirstName")
                    </td>
                </tr>
                <tr>
                    <td>
                        Last Name:
                    </td>
                    <td>
                        <input type="text" id="TxtLName" name="LastName" value="@Model.LastName" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        @Html.ValidationMessage("LastName")
                    </td>
                </tr>
                <tr>
                    <td>
                        Salary:
                    </td>
                    <td>
                        <input type="text" id="TxtSalary" name="Salary" value="@Model.Salary" />
                </tr>
                <tr>
                    <td colspan="2" align="right">
                        @Html.ValidationMessage("Salary")
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" name="BtnSubmit" value="Save Employee" onclick="IsValid();" />
                        <input type="submit" name="BtnSubmit" value="Cancel" />
                        <input type="button" name="BtnReset" value="Reset" onclick="ResetForm();" />
                    </td>
                </tr>
            </table>
        </form>
    </body>
    </html>*@
